﻿#pragma once

#include <QObject>
#include <QUrl>

#include "CefWebEngineCore/CefWebEngineCoreGlobal.h"

class CefWebEnginePrivate;
class CefWebEnginePage;

class CEFWEBENGINECORE_EXPORT CefWebEngine : public QObject
{
    Q_OBJECT

public:
    CefWebEngine(QObject *parent = nullptr);
    ~CefWebEngine();

    static CefWebEngine *instance() { return self; }

private:
    CefWebEnginePage *createPage(const QUrl &url, quintptr windowId, bool init = true);
    void setDevToolsPage(CefWebEnginePage *page, CefWebEnginePage *devPage);

private:
    Q_DISABLE_COPY(CefWebEngine);
    Q_DECLARE_PRIVATE(CefWebEngine);
    QScopedPointer<CefWebEnginePrivate> d_ptr;
    
    static CefWebEngine *self;
    
    friend class CefWebEnginePage;
    friend class CefWebEngineView;
};